package cn.calm.xhtml.impl.fun;

import cn.calm.xhtml.annotation.Attribute;
import cn.calm.xhtml.annotation.Tag;
import cn.calm.xhtml.api.Template;
import cn.calm.xhtml.api.exception.XhtmlException;
import cn.calm.xhtml.api.service.AbstraceNodeProcess;
import cn.calm.xhtml.api.service.XhtmlContext;
@Tag(namespace = "http://www.calm.cn/xhtml/extras/core", attributes = {
		@Attribute(name = "url", description = "包含路径", template = "<label></label><input name=\"url\"/>")})
public class Include extends AbstraceNodeProcess {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void processNode(XhtmlContext context) throws XhtmlException {
		String attr = getAttr("url");
		if (attr == null) {
			throw new XhtmlException("attr url is:null");
		} 
		Template template = context.getTemplateEngine().getTemplate(attr);
		template.render(context);
	}

}
